#include "Operator.h"

Operator::Operator(OpType ot, std::string content):m_type(ot),m_content(content){    //CHANGE TO QSTRING
    switch (m_type) {
        case SUM:
        case SUB:{
            m_priority = LOW;
            break;
        }
        case MULT:
        case DIV: {
            m_priority = HIGH;
            break;
        }
    }
}
Operator::~Operator(){}

double
Operator::toDouble(std::string input){  //TODO QString
    double output=1;
    return output;
}

double
Operator::exec(std::string num){                     //TODO Change to Qstring
   double first = toDouble(m_content);
   double second = toDouble(num);

    switch(m_type) {
        case SUM:{
            return first+second;
        }
        case SUB:{
            return first-second;
        }
        case DIV:{
            return first/second;
        }
        case MULT:{
            return first*second;
        }
    }
}

